"use strict";

const csharp_1 = require("csharp");
const App = csharp_1.FairyEditor.App;

let preActive = App.isActive;

let onUpdate = function() {
    var active = App.isActive;
    if (preActive == active) {
        return;
    }

    preActive = active;
    if (active) {
        // 从后台返回
        // console.log("检测到从后台返回, 触发App.RefreshProject();")
        App.RefreshProject();
    } else {
        // 切到后台
        // console.log("检测切到后台")
    }
}

App.add_onUpdate(onUpdate);

exports.onDestroy = function(){
    App.remove_onUpdate(onUpdate);
}